//
//  ST_TriangleView.swift
//  btvideo
//
//  Created by mac on 2020/1/17.
//  Copyright © 2020 JarvanZhang. All rights reserved.
//

import UIKit

class ST_TriangleView : UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = UIColor.white
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }

    override func draw(_ rect: CGRect) {

        guard let context = UIGraphicsGetCurrentContext() else { return }

        context.beginPath()
        context.move(to: CGPoint(x: 0, y: 0))
        context.addLine(to: CGPoint(x: rect.maxX, y: (rect.maxY / 2.0)))
        context.addLine(to: CGPoint(x: rect.minX, y: rect.maxY))
        context.closePath()
        context.setFillColor(red: 1, green: 0.76, blue: 0.03, alpha: 1)
        context.fillPath()
    }
}
